package oj;

import java.util.Scanner;

public class Day20S {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String str1 = sc.nextLine();
            String str2 = sc.nextLine();
            System.out.println(getMaxLen(str1, str2));

        }
    }

    private static int getMaxLen(String str1, String str2) {
        char[] arr1=str1.toCharArray();
        char[] arr2=str2.toCharArray();
        int maxLen=0;
        int[][] arr=new int[str1.length()+1][str2.length()+1];
        for (int i = 0; i < str1.length()+1; i++) {
            arr[i][0]=0;
        }
        for (int i = 0; i < str2.length()+1; i++) {
            arr[0][i]=0;
        }
        for (int i = 1; i < str1.length()+1; i++) {
            for (int j = 1; j < str2.length()+1; j++) {
                if(arr1[i-1]==arr2[j-1]) {
                    arr[i][j] = arr[i - 1][j - 1] + 1;
                    if (maxLen < arr[i][j]) {
                        maxLen = arr[i][j];
                    }
                }
            }
        }
        return maxLen;
    }
}
